package com.jni.sample;

import androidx.appcompat.app.AppCompatActivity;

import android.annotation.SuppressLint;
import android.hardware.usb.UsbDevice;
import android.os.Bundle;
import android.util.Log;
import android.widget.TextView;

import com.dtalks.auth.AuthNative;

public class MainActivity extends AppCompatActivity {

    // Used to load the 'native-lib' library on application startup.
    static {
        System.loadLibrary("native-lib");
    }

    @SuppressLint("SetTextI18n")
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        // Example of a call to a native method
        TextView tv = findViewById(R.id.sample_text);
//        tv.setText(stringFromJNI());
//        Log.i("jishen", "add:" + JniNative.JniCAdd(10, 20));
//        Log.i("jishen", "sub:" + JniNative.JniCSub(100, 20));
        Log.i("jishen", "device:" + AuthNative.deviceKey(this, null, "123456789"));
        Log.i("jishen", "business:" + AuthNative.businessKey(this, "123456789"));
//        JniBean bean = new JniBean();
//        bean.setName("laikang");
//        bean.setWhat(1000);
        String deviceKey = AuthNative.deviceKey(this, null, "123456789");
        String businessKey = AuthNative.businessKey(this, "123456789");
        tv.setText("deviceKey:" + deviceKey + "\n\n\n" + "businessKey:" + businessKey);
    }

    /**
     * A native method that is implemented by the 'native-lib' native library,
     * which is packaged with this application.
     */
    public native String stringFromJNI();

    public String getProductName() {
        return "laikang";
    }
}
